const app = getApp();
Page({
  data: {
    rule_on: '',
    g_iphone: '',
    page: 1,
    page_size: 20,
    qian: [],
    num: 1
  },
  onReady: function () {
    app.SystemInfo(this)
  },
  onLoad: function () {
    var This = this;
    this.getData()
  },
  getData() {
    let that = this
    app.request(app.apiDomain + "index.php?c=user&a=get_user_bill_list", {
      page: that.data.page,
      page_size: that.data.page_size
    }, function (res) {
      console.log(res.data);
      if (res.data.status == 1) {
        let isBottom = false
        if (res.data.data.list.length < 20 && that.data.num > 1) {
          isBottom = true
          wx.showToast({
            title: '已经到底了',
            icon: 'none'
          })
        } else {
          isBottom = false
        }
        that.data.num++
        that.setData({
          qian: that.data.qian.concat(res.data.data.list),
          money: res.data.data.money,
          isBottom,
          num: that.data.num
        })
      } else {
        wx.showToast({
          title: res.data.info,
          icon: 'none'
        })
      }      
    });
  },
  scrollBottom () {
    console.log(1111)
    let that = this
    if (that.data.isBottom) {
      return
    }
    that.data.isBottom = true
    that.data.page++
    that.setData({
      isBottom: true,
      page: that.data.page
    })
    that.getData()
  },
  gao_click: function () {
    console.log(1)
    this.setData({
      gao_on: 'on'
    })
  },
  gao_off: function () {
    this.setData({
      gao_on: ''
    })
  },
  onShareAppMessage: function () {
    return app.onShareAppMessage();
  }
})
